package org.example.leetCode;

/**
 * @author Administrator
 */
public class ReplaceSpace {
    public String replaceSpace(String s) {
        if (s == null) {
            return null;
        }
        StringBuilder stringBuilder = new StringBuilder();
        char[] chars = s.toCharArray();
        for (char c : chars) {
            if (c == ' ') {
                stringBuilder.append("%20");
            } else {
                stringBuilder.append(c);
            }
        }
        String s1 = stringBuilder.toString();
        return s1;
    }
}
